/**
 * JAVACC DEMO 1.0
 */
package com.apache.uct.service.plugins;

import com.apache.api.manager.PluginConnector;
import com.apache.api.vo.ParamsVo;
import com.apache.api.vo.ResultEntity;
import com.apache.database.constant.SystemTools;
import com.apache.database.constant.Validator;

import java.util.HashMap;
import java.util.Map;

/**
 * description:  获取纺一配置信息内容
 *
 * @author iussoft 创建时间：2016-3-30
 */
public class UnitySystemConfigPlugin implements PluginConnector {

    /**
     * TODO 获取纺一配置信息内容.  <br>
     */
    public Object execute(ParamsVo arg0) throws Exception {
        ResultEntity result = new ResultEntity();
        result.setResult("true");
        Map<String, String> config = new HashMap<String, String>();
        try {
            Map<String, String> map = SystemTools.getInstance().getMap();
            if (!Validator.isEmpty(map)) {
                for (String key : map.keySet()) {
                    if (key.startsWith("unity_")) {
                        config.put(key.replaceAll("unity_", ""), map.get(key));
                    }
                }
            }
            result.setEntity(config);
            result.setMessage("获取用户中心配置信息成功");
        } catch (Exception e) {
            result.setResult("false");
            result.setMessage("发生未知异常！");
        }
        return result;
    }

}
